#include "../header.h"

//1.opendir
//2.readdir
//3.closedir

int main(int argc, char const *argv[])
{
    //打开目录文件
    DIR * dir = opendir("..");
    if (dir == NULL)
    {
        /* code */
        perror("opendir error\n");
        return -1;
    }
    //读目录文件
    //目录流指针 - 目录读写指针 
    struct dirent * every = readdir(dir);
    while(every)
    {
        printf("%s\n",every->d_name);
        every = readdir(dir);
    }
    //关闭目录文件
    closedir(dir);
    return 0;
}
